import tkinter as tk

def display_weekdays():
    """在文本框中显示从星期一到星期天的内容"""
    weekdays = [
        "星期一",
        "星期二", 
        "星期三",
        "星期四",
        "星期五",
        "星期六",
        "星期日"
    ]
    
    # 清空文本框内容
    text_box.delete(1.0, tk.END)
    
    # 将星期内容逐行插入文本框
    for day in weekdays:
        text_box.insert(tk.END, day + "\n")

def exit_program():
    """退出程序"""
    root.destroy()

# 创建主窗口
root = tk.Tk()
root.title("星期显示程序")
root.geometry("300x250")

# 创建执行按钮
execute_button = tk.Button(
    root, 
    text="显示星期", 
    command=display_weekdays,
    height=2,
    width=21
)
execute_button.pack(pady=10)

# 创建文本框
text_box = tk.Text(
    root,
    height=10,
    width=25
)
text_box.pack(pady=10)

# 创建退出按钮
exit_button = tk.Button(
    root,
    text="退出",
    command=exit_program,
    height=2,
    width=20
)
exit_button.pack(pady=10)

# 运行主循环
root.mainloop()
print("程序已结束")